/*
*
* SPDX-License-Identifier: GPL-2.0
*
* Copyright (C) 2011-2018 ARM or its affiliates
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2.
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/

#include "acamera_command_api.h"
//#include "acamera_firmware_api.h"
#include "acamera_firmware_settings.h"
// created from 2016-10-19T16:42:58.865Z UTClinear.json

// CALIBRATION_LIGHT_SRC
static uint16_t _calibration_light_src[][2] = {
  {256,256}};

// CALIBRATION_RG_POS
static uint16_t _calibration_rg_pos[]
 = {166,181,197,213,229,245,256,277,292,308,324,340,356,372,407};

// CALIBRATION_BG_POS
static uint16_t _calibration_bg_pos[]
 = {128,148,163,177,192,207,221,236,256,266,280,295,310,324,353};

// CALIBRATION_MESH_RGBG_WEIGHT
static uint16_t _calibration_mesh_rgbg_weight[][15] = {
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 16, 256, 221 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 15, 75, 256, 256, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 3, 22, 102, 256, 256, 106, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 6, 35, 133, 256, 256, 121, 13, 0 },
  { 0, 0, 0, 0, 0, 1, 5, 62, 256, 256, 256, 118, 17, 1, 0 },
  { 0, 0, 0, 0, 1, 10, 43, 256, 256, 256, 127, 20, 1, 0, 0 },
  { 0, 0, 0, 0, 11, 94, 228, 256, 256, 129, 20, 1, 0, 0, 0 },
  { 0, 0, 1, 23, 171, 256, 256, 256, 74, 8, 0, 0, 0, 0, 0 },
  { 0, 0, 8, 100, 256, 256, 256, 110, 17, 1, 0, 0, 0, 0, 0 },
  { 0, 2, 64, 256, 256, 256, 136, 15, 1, 0, 0, 0, 0, 0, 0 },
  { 0, 12, 256, 256, 200, 44, 11, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 45, 256, 173, 20, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 256, 249, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 9, 256, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }};

// CALIBRATION_MESH_LS_WEIGHT
static uint16_t _calibration_mesh_ls_weight[][15] = {
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 3, 4, 25, 42, 53, 57, 53, 42, 25, 4, 3, 0, 0 },
  { 0, 0, 4, 131, 157, 179, 193, 198, 193, 179, 157, 131, 4, 0, 0 },
  { 0, 0, 25, 157, 188, 214, 232, 238, 232, 214, 188, 157, 25, 0, 0 },
  { 0, 0, 42, 179, 214, 243, 255, 256, 255, 243, 214, 179, 42, 0, 0 },
  { 0, 0, 53, 193, 232, 255, 256, 256, 256, 255, 232, 193, 53, 0, 0 },
  { 0, 0, 57, 198, 238, 256, 256, 256, 256, 256, 238, 198, 57, 0, 0 },
  { 0, 0, 53, 193, 232, 255, 256, 256, 256, 255, 232, 193, 53, 0, 0 },
  { 0, 0, 42, 179, 214, 243, 255, 256, 255, 243, 214, 179, 42, 0, 0 },
  { 0, 0, 25, 157, 188, 214, 232, 238, 232, 214, 188, 157, 25, 0, 0 },
  { 0, 0, 4, 131, 157, 179, 193, 198, 193, 179, 157, 131, 4, 0, 0 },
  { 0, 0, 3, 4, 25, 42, 53, 57, 53, 42, 25, 4, 3, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }};

// CALIBRATION_MESH_COLOR_TEMPERATURE
static uint16_t _calibration_mesh_color_temperature[][15] = {
  { 210, 223, 237, 252, 266, 280, 290, 309, 322, 335, 349, 362, 374, 385, 385 },
  { 196, 209, 223, 237, 252, 265, 275, 294, 307, 321, 334, 349, 362, 374, 385 },
  { 187, 198, 213, 227, 241, 255, 264, 282, 296, 310, 324, 338, 352, 365, 385 },
  { 179, 190, 203, 217, 231, 245, 254, 272, 285, 299, 314, 328, 342, 356, 385 },
  { 170, 181, 193, 207, 221, 235, 244, 260, 274, 288, 302, 316, 331, 345, 385 },
  { 161, 172, 184, 196, 210, 224, 234, 252, 262, 277, 291, 305, 319, 334, 364 },
  { 154, 164, 176, 188, 200, 214, 224, 242, 254, 266, 280, 295, 309, 323, 356 },
  { 154, 155, 167, 179, 191, 204, 213, 232, 245, 257, 269, 283, 298, 312, 345 },
  { 140, 150, 156, 167, 179, 191, 200, 218, 231, 245, 257, 268, 283, 297, 328 },
  { 133, 143, 154, 162, 173, 185, 194, 211, 224, 238, 251, 262, 275, 289, 320 },
  { 131, 133, 143, 154, 165, 177, 185, 201, 214, 228, 242, 254, 265, 279, 310 },
  { 121, 127, 133, 143, 156, 168, 177, 192, 204, 218, 232, 245, 257, 267, 298 },
  { 112, 118, 124, 130, 143, 160, 168, 183, 195, 207, 221, 235, 249, 259, 287 },
  { 103, 109, 115, 121, 128, 144, 159, 175, 186, 198, 211, 225, 239, 251, 277 },
  { 100, 100, 100, 100, 109, 115, 120, 145, 169, 181, 193, 205, 219, 233, 259 }};

// RG, BG, MULT. final wb gain adjuster for a sky scene. devided by CALIBRATION_WB_STRENGTH_MULT in use
static uint16_t _calibration_wb_strength[] = {1000, 1000, 1000};

// lux threshold for sky
static uint16_t _calibration_sky_lux_th[] = {10000};

// 1D rg/bg readout from color_temp
static uint16_t _calibration_ct_rg_pos_calc[]
 = {181,205,219,256,292,302,349,365,387};

// 1D rg/bg readout from color_temp
static uint16_t _calibration_ct_bg_pos_calc[]
 = {338,301,287,256,228,219,180,167,148};

// CALIBRATION_COLOR_TEMP
static uint16_t _calibration_color_temp[]
 = {100,133,154,200,250,263,333,357,385};

// CALIBRATION_CT65POS
static uint16_t _calibration_ct65pos[] = {2};

// CALIBRATION_CT40POS
static uint16_t _calibration_ct40pos[] = {8};

// CALIBRATION_CT30POS
static uint16_t _calibration_ct30pos[] = {6};

// CALIBRATION_EVTOLUX_EV_LUT
static uint32_t _calibration_evtolux_ev_lut[]
 = {101156,188068,303007,605059,944040,1216255,1296431,1473159,1820856,2067789,2319065,2994398,4858650};

// CALIBRATION_EVTOLUX_LUX_LUT
static uint32_t _calibration_evtolux_lux_lut[]
 = {18000,15000,10000,5000,2000,1000,800,500,200,100,50,10,1};

// CALIBRATION_BLACK_LEVEL_R
static uint16_t _calibration_black_level_r[][2] = {
  { 0, 240 },
  { 32, 240 },
  { 64, 240 },
  { 96, 240 },
  { 128, 240 },
  { 160, 242 }};

// CALIBRATION_BLACK_LEVEL_GR
static uint16_t _calibration_black_level_gr[][2] = {
  { 0, 240 },
  { 32, 240 },
  { 64, 240 },
  { 96, 240 },
  { 128, 240 },
  { 160, 242 }};

// CALIBRATION_BLACK_LEVEL_GB
static uint16_t _calibration_black_level_gb[][2] = {
  { 0, 240 },
  { 32, 240 },
  { 64, 240 },
  { 96, 240 },
  { 128, 241 },
  { 160, 242 }};

// CALIBRATION_BLACK_LEVEL_B
static uint16_t _calibration_black_level_b[][2] = {
  { 0, 240 },
  { 32, 240 },
  { 64, 240 },
  { 96, 240 },
  { 128, 241 },
  { 160, 242 }};

// CALIBRATION_STATIC_WB
static uint16_t _calibration_static_wb[]
 = {420,256,256,490};

// RR RG RB GR GG GB BR BG BB
static uint16_t _calibration_mt_absolute_ls_a_ccm[]
 = {415,32887,32808,32873,410,32817,33,32982,437};

// RR RG RB GR GG GB BR BG BB
static uint16_t _calibration_mt_absolute_ls_d40_ccm[]
 = {438,32921,32797,32863,412,32829,30,32965,423};

// RR RG RB GR GG GB BR BG BB
static uint16_t _calibration_mt_absolute_ls_d50_ccm[]
 = {454,32940,32794,32854,410,32836,29,32960,419};

// CALIBRATION_SHADING_LS_A_R
static uint8_t _calibration_shading_ls_a_r[]
 = {134,107,91,80,71,65,60,56,52,49,47,45,43,42,41,41,40,40,40,41,42,43,45,47,49,52,56,60,65,72,80,92,124,101,86,76,68,62,57,54,50,47,45,43,42,41,40,39,39,39,39,40,41,42,43,45,48,50,54,58,63,69,77,87,114,95,82,73,66,60,55,51,49,46,44,42,41,40,39,38,38,38,38,39,40,41,42,44,46,48,52,56,61,66,74,84,106,90,78,70,63,58,53,50,47,44,43,41,40,39,38,37,37,37,37,37,38,40,41,42,44,47,50,54,58,64,71,79,100,86,75,68,61,56,52,48,45,43,41,40,38,37,37,36,36,36,36,36,37,38,40,41,43,46,48,52,56,62,68,76,95,83,73,65,59,54,50,47,44,42,40,39,37,37,36,35,35,35,35,36,36,37,39,40,42,44,47,50,54,60,66,74,92,80,71,63,57,53,49,46,43,41,39,38,37,36,35,35,34,34,35,35,36,37,38,39,41,43,46,49,53,58,64,72,89,77,69,62,56,51,48,45,42,40,38,37,36,35,34,34,34,34,34,34,35,36,37,38,40,42,45,48,52,57,62,69,87,75,67,60,54,50,47,44,41,39,37,36,35,34,34,34,34,33,34,34,34,35,36,37,39,41,44,47,51,55,61,68,85,74,65,59,54,49,46,43,40,38,37,35,35,34,34,33,33,33,33,34,34,34,36,37,38,40,43,46,50,54,60,67,83,72,64,57,52,48,45,42,40,38,36,35,34,34,33,33,33,33,33,33,34,34,35,37,38,40,42,45,49,53,59,65,81,70,63,56,52,48,44,42,39,37,36,35,34,33,33,33,33,33,33,33,33,34,35,36,37,39,42,45,48,52,57,64,80,70,62,56,51,47,44,41,39,37,35,34,34,33,33,33,33,33,33,33,33,34,34,36,37,39,41,44,48,52,57,63,79,69,61,55,50,46,43,41,38,36,35,34,33,33,33,32,32,32,33,33,33,34,34,35,37,39,41,44,47,51,56,62,78,68,61,55,50,46,43,40,38,36,35,34,33,33,33,32,32,32,32,33,33,33,34,35,36,38,40,43,47,51,56,62,77,68,60,55,50,46,43,40,38,36,35,34,33,33,32,32,32,32,32,33,33,33,34,35,36,38,40,43,46,50,55,61,77,67,60,54,49,46,42,40,38,36,34,34,33,33,32,32,32,32,32,32,33,33,34,35,36,38,40,43,46,50,55,61,76,67,60,54,49,45,42,40,38,36,34,33,33,33,32,32,32,32,32,32,33,33,34,35,36,38,40,43,46,51,55,61,77,67,60,54,49,45,42,40,38,36,34,33,33,33,32,32,32,32,32,33,33,33,34,35,36,38,40,43,46,50,55,62,77,67,60,54,49,46,43,40,38,36,34,34,33,33,32,32,32,32,32,33,33,33,34,35,36,38,41,43,47,50,56,62,77,68,60,54,50,46,43,40,38,36,35,34,33,33,33,32,32,32,32,33,33,33,34,35,36,38,41,43,47,51,56,62,78,68,61,55,50,46,43,40,38,36,35,34,33,33,33,33,32,32,33,33,33,34,34,35,37,39,41,44,47,51,56,62,79,69,62,55,50,47,44,41,38,37,35,34,34,33,33,33,33,32,33,33,33,34,34,36,37,39,41,44,48,52,57,63,81,70,63,56,51,47,44,41,39,37,36,34,34,33,33,33,33,33,33,33,33,34,35,36,37,39,42,45,48,53,58,64,82,72,64,57,52,48,45,42,39,37,36,35,34,33,33,33,33,33,33,33,34,34,35,36,38,40,43,45,49,53,59,66,83,73,65,58,53,49,45,43,40,38,37,35,34,34,34,33,33,33,33,33,34,35,36,37,39,41,43,46,50,54,60,67,85,74,66,60,54,50,46,43,41,39,37,36,35,34,34,34,33,33,33,34,34,35,36,38,40,41,44,47,51,55,61,68,89,77,68,61,55,51,47,44,42,40,38,37,36,35,34,34,34,34,34,34,35,36,37,38,41,42,45,48,52,57,62,70,91,79,70,63,57,52,48,45,43,40,39,37,36,35,35,35,34,34,35,35,36,37,38,39,41,43,46,49,53,58,64,72,95,81,72,64,58,53,49,46,44,41,40,38,37,36,36,35,35,35,35,36,37,37,39,40,42,44,47,51,55,59,66,75,99,84,74,66,60,55,51,48,45,43,41,39,38,37,37,36,36,36,36,37,37,38,40,41,43,45,48,52,56,62,68,77,103,88,77,68,62,57,52,49,46,44,42,40,39,38,37,37,36,36,37,37,38,39,40,42,44,47,49,54,58,64,71,80};

// CALIBRATION_SHADING_LS_A_G
static uint8_t _calibration_shading_ls_a_g[]
 = {115,94,80,71,64,59,55,52,49,46,44,43,42,41,40,39,39,39,39,40,41,42,43,44,46,49,52,55,60,65,72,81,106,89,77,68,62,57,53,50,47,45,43,42,40,39,39,38,38,38,38,39,39,40,42,43,45,47,50,54,58,63,69,77,98,84,73,66,60,55,51,48,46,44,42,40,39,38,38,37,37,37,37,37,38,39,40,42,44,46,49,52,56,60,66,74,93,80,70,63,58,53,50,47,44,42,41,39,38,37,37,36,36,36,36,36,37,38,39,41,43,45,47,50,54,58,64,71,88,77,68,61,56,52,48,46,43,41,40,38,37,36,36,35,35,35,35,36,36,37,38,40,41,43,46,49,52,57,62,68,84,74,66,59,54,51,47,45,42,40,39,37,36,36,35,35,34,34,35,35,36,36,38,39,40,42,45,48,51,55,60,66,81,71,64,58,53,49,46,43,41,39,38,37,36,35,34,34,34,34,34,34,35,36,37,38,40,41,44,47,50,54,58,64,79,69,62,56,52,48,45,43,40,39,37,36,35,34,34,34,34,34,34,34,35,35,36,37,39,41,43,46,49,52,57,62,77,68,61,55,51,47,44,42,40,38,36,35,34,34,34,33,33,33,33,34,34,35,36,37,38,40,42,45,48,51,56,61,75,66,59,54,50,47,43,41,39,37,36,35,34,34,33,33,33,33,33,33,34,34,35,36,38,39,41,44,47,51,55,60,73,65,59,53,49,46,43,40,38,37,35,34,34,33,33,33,33,33,33,33,33,34,35,36,37,39,41,43,46,50,54,59,72,64,58,53,48,45,42,40,38,36,35,34,34,33,33,33,33,33,33,33,33,34,34,35,37,38,40,43,46,49,53,58,71,63,57,52,48,45,42,39,37,36,35,34,33,33,33,32,32,32,33,33,33,33,34,35,36,38,40,42,45,48,53,57,70,62,56,51,47,44,41,39,37,36,34,34,33,33,32,32,32,32,32,33,33,33,34,35,36,38,39,42,45,48,52,57,69,62,56,51,47,44,41,39,37,35,34,33,33,33,32,32,32,32,32,32,33,33,34,34,36,37,39,42,44,48,52,57,69,61,55,51,47,44,41,39,37,35,34,33,33,33,32,32,32,32,32,32,33,33,34,34,36,37,39,41,44,48,52,56,69,61,55,51,47,43,41,38,37,35,34,33,33,32,32,32,32,32,32,32,33,33,33,34,35,37,39,41,44,47,51,56,69,61,55,50,47,43,41,38,37,35,34,33,33,32,32,32,32,32,32,32,33,33,33,34,35,37,39,41,44,47,51,56,69,61,55,50,47,43,41,38,37,35,34,33,33,32,32,32,32,32,32,32,33,33,33,34,35,37,39,41,44,47,51,56,69,61,55,51,47,43,41,39,37,35,34,33,33,33,32,32,32,32,32,32,33,33,34,34,36,37,39,41,44,48,52,56,69,61,56,51,47,44,41,39,37,35,34,33,33,33,32,32,32,32,32,32,33,33,34,34,36,37,39,42,44,48,52,57,70,62,56,51,47,44,41,39,37,36,34,34,33,33,33,32,32,32,32,33,33,33,34,35,36,37,39,42,45,48,52,57,71,63,57,52,48,44,42,39,37,36,34,34,33,33,33,32,32,32,32,33,33,33,34,35,36,38,40,42,45,49,53,58,72,64,57,52,48,45,42,40,38,36,35,34,33,33,33,33,32,32,32,33,33,33,34,35,36,38,40,43,46,49,53,58,73,65,58,53,49,45,42,40,38,36,35,34,34,33,33,33,33,32,33,33,33,34,34,36,37,39,41,43,46,50,54,59,74,66,59,54,49,46,43,41,39,37,36,35,34,33,33,33,33,33,33,33,33,34,35,36,37,39,41,44,47,51,55,60,76,67,60,55,50,47,44,41,39,37,36,35,34,34,33,33,33,33,33,33,34,35,35,37,38,40,42,45,48,51,56,61,79,69,61,56,51,48,45,42,40,38,37,36,35,34,34,33,33,33,33,34,34,35,36,37,39,40,43,45,48,52,57,62,81,71,63,57,52,48,45,43,41,39,37,36,35,35,34,34,34,34,34,34,35,36,37,38,40,41,44,46,49,53,58,64,83,72,65,58,54,50,46,44,42,40,38,37,36,35,35,34,34,34,34,35,35,36,37,39,40,42,44,47,51,55,60,66,86,75,66,60,55,51,48,45,42,40,39,38,37,36,35,35,35,35,35,35,36,37,38,39,41,43,45,48,52,56,61,68,90,78,68,61,56,52,49,46,43,41,40,38,37,37,36,36,35,35,36,36,37,38,39,40,42,44,46,49,53,58,63,70};

// CALIBRATION_SHADING_LS_A_B
static uint8_t _calibration_shading_ls_a_b[]
 = {106,88,76,68,62,57,53,49,47,45,43,42,41,40,39,39,38,38,39,40,41,41,42,44,46,48,51,54,58,63,70,79,99,84,73,65,59,55,51,48,46,44,42,41,40,39,38,38,37,37,38,39,39,40,41,43,45,47,49,52,56,61,67,75,92,79,70,63,57,53,50,47,44,43,41,40,39,38,37,37,36,37,37,37,38,39,40,42,43,45,48,51,54,59,64,71,88,76,67,61,56,52,48,46,43,42,40,39,38,37,36,36,36,36,36,36,37,38,39,41,42,44,47,49,53,57,62,68,83,73,65,59,54,50,47,45,42,41,39,38,37,36,36,35,35,35,35,36,36,37,38,40,41,43,45,48,51,55,60,66,79,70,63,57,53,49,46,44,41,40,38,37,36,36,35,34,34,34,35,35,36,36,37,39,40,42,44,47,50,54,59,65,77,68,61,56,52,48,45,43,41,39,38,37,36,35,34,34,34,34,34,34,35,36,37,38,39,41,43,46,49,52,57,63,75,67,60,55,50,47,44,42,40,38,37,36,35,34,34,34,34,34,34,34,34,35,36,37,39,40,42,45,48,51,56,61,73,65,59,53,49,46,43,41,39,38,36,35,34,34,34,33,33,34,34,34,34,35,36,37,38,40,42,44,47,50,54,59,71,63,57,52,49,46,43,41,39,37,36,35,34,34,33,33,33,33,33,34,34,34,35,36,38,39,41,44,46,50,53,58,69,63,57,52,48,45,42,40,38,37,35,34,34,34,33,33,33,33,33,33,34,34,35,36,37,39,41,43,46,49,53,57,69,61,56,51,47,44,42,40,38,36,35,34,34,33,33,33,33,33,33,33,33,34,34,35,36,38,40,42,45,48,52,56,68,61,55,51,47,44,41,39,37,36,35,34,34,33,33,33,33,33,33,33,33,34,34,35,36,37,40,42,45,48,51,55,67,60,55,50,46,44,41,39,37,36,34,34,33,33,32,32,32,32,33,33,33,33,34,35,36,37,39,41,44,47,51,55,67,60,54,50,46,43,41,39,37,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,35,37,39,41,44,47,51,55,66,60,54,49,46,43,41,38,36,35,34,34,33,33,32,32,32,32,32,32,33,33,33,34,35,37,39,41,43,47,50,55,65,59,54,49,46,43,40,38,37,35,34,33,33,33,32,32,32,32,32,32,33,33,33,34,35,37,39,41,43,47,50,54,65,59,54,49,46,43,40,38,36,35,34,33,33,33,32,32,32,32,32,32,33,33,33,34,35,37,38,41,43,46,50,54,66,59,54,49,45,43,40,38,37,35,34,33,33,32,32,32,32,32,32,32,33,33,33,34,35,37,38,41,43,46,50,54,66,59,54,49,46,43,40,38,37,35,34,33,33,33,33,32,32,32,32,32,33,33,34,34,35,37,39,41,43,47,50,54,66,59,54,49,46,43,41,39,37,35,34,33,33,33,33,32,32,32,32,32,33,33,33,34,35,37,39,41,44,47,50,55,67,60,54,50,46,43,41,39,37,36,34,34,33,33,33,32,32,32,32,32,33,33,34,34,35,37,39,41,44,47,51,55,67,61,55,50,46,44,41,39,37,36,34,34,33,33,33,33,32,32,32,33,33,33,34,34,36,37,39,42,44,47,51,56,68,61,56,51,47,44,42,39,37,36,35,34,33,33,33,33,32,32,32,33,33,33,34,35,36,38,40,42,45,48,51,56,69,62,57,51,48,44,42,40,38,36,35,34,34,33,33,33,33,33,33,33,33,33,34,35,37,38,40,42,45,48,52,57,71,63,57,52,49,45,42,40,38,37,35,35,34,33,33,33,33,33,33,33,33,34,34,36,37,39,41,43,46,49,53,58,72,64,58,53,49,45,43,41,39,37,36,35,34,34,33,33,33,33,33,33,33,34,35,36,38,39,41,44,47,49,54,59,75,66,59,54,50,47,44,41,40,38,36,35,35,34,34,33,33,33,33,33,34,35,35,37,38,40,42,44,47,51,55,60,77,68,61,55,51,47,44,42,40,38,37,36,35,34,34,33,34,33,33,34,34,35,36,37,39,40,42,45,48,52,56,62,80,70,62,56,52,48,45,43,41,39,38,37,36,35,34,34,34,34,34,34,35,36,37,38,40,41,44,46,49,53,57,63,84,73,64,58,53,49,46,44,42,40,38,37,36,36,35,35,34,34,35,35,36,36,38,39,40,42,44,47,50,54,59,65,88,75,65,59,55,51,47,45,42,41,39,38,37,36,36,35,35,35,35,36,36,37,38,40,41,43,45,48,51,55,61,67};

// CALIBRATION_SHADING_LS_TL84_R
static uint8_t _calibration_shading_ls_tl84_r[]
 = {133,105,89,78,71,64,59,55,52,49,46,45,43,42,41,40,40,40,40,41,42,43,45,47,49,52,55,59,65,71,79,90,122,100,84,75,68,62,57,53,50,47,45,43,42,41,40,39,39,39,39,40,41,42,43,45,48,50,53,57,62,68,76,87,111,94,81,72,65,59,55,51,48,45,44,42,41,39,39,38,38,38,38,38,39,40,42,43,46,48,51,55,60,66,73,83,104,88,77,69,63,57,53,50,47,44,42,41,39,38,37,37,37,37,37,37,38,39,41,42,44,47,50,53,58,63,70,80,99,85,75,67,60,55,51,48,45,43,41,40,38,37,37,36,36,36,36,36,37,38,40,41,43,45,48,52,56,61,68,77,94,82,72,65,59,54,50,47,44,42,40,38,37,36,36,35,35,35,35,36,36,37,38,40,42,44,47,50,54,59,66,74,90,78,70,63,57,53,49,46,43,41,39,38,37,36,35,35,34,34,35,35,36,36,38,39,41,43,46,49,53,58,63,71,87,76,68,61,55,51,47,45,42,40,38,37,36,35,34,34,34,34,34,34,35,36,37,38,40,42,45,48,52,56,62,69,85,74,66,60,54,50,46,43,41,39,37,36,35,34,34,34,34,33,34,34,34,35,36,38,39,41,44,47,50,55,61,68,83,73,65,58,53,49,46,43,40,38,37,35,35,34,34,34,33,33,33,34,34,35,36,37,38,40,43,46,50,54,59,66,80,71,63,57,52,48,45,42,39,38,36,35,34,34,33,33,33,33,33,34,34,34,35,36,38,40,42,45,49,53,58,65,79,70,62,56,51,47,44,41,39,37,35,35,34,33,33,33,33,33,33,33,34,34,35,36,37,39,41,44,48,52,57,64,78,69,62,55,51,47,43,41,38,37,35,34,34,33,33,33,33,33,33,33,33,34,34,36,37,39,41,44,47,51,56,62,78,68,61,55,50,46,43,40,38,36,35,34,33,33,33,32,32,32,33,33,33,33,34,35,37,38,41,43,47,51,56,62,77,67,60,54,50,46,43,40,38,36,35,34,33,33,33,32,32,32,32,33,33,33,34,35,36,38,40,43,47,51,55,61,76,67,60,54,49,46,42,40,38,36,34,34,33,33,33,32,32,32,32,33,33,33,34,35,36,38,40,43,46,50,55,61,76,67,59,54,49,46,42,40,38,36,34,34,33,33,32,32,32,32,32,33,33,33,34,35,36,38,40,43,46,50,55,61,76,66,59,54,49,45,42,40,37,36,34,34,33,33,32,32,32,32,32,32,33,33,34,35,36,38,40,43,46,50,55,61,76,66,60,53,49,45,42,40,38,36,34,34,33,33,32,32,32,32,32,33,33,33,34,35,36,38,40,43,46,50,55,61,76,67,59,54,49,45,42,40,37,36,34,34,33,33,33,32,32,32,32,33,33,33,34,35,36,38,40,43,46,50,55,61,76,67,60,54,50,46,42,40,38,36,35,34,33,33,33,32,32,32,32,33,33,33,34,35,36,38,40,43,47,50,55,62,77,67,60,54,50,46,43,40,38,36,35,34,34,33,33,33,32,32,33,33,33,34,34,35,37,39,41,43,47,51,56,62,78,69,61,55,50,47,43,40,38,36,35,34,34,33,33,33,33,32,33,33,33,34,34,35,37,39,41,44,48,52,57,63,79,69,62,56,51,47,44,41,39,37,35,35,34,33,33,33,33,33,33,33,33,34,35,36,37,39,42,45,48,52,57,63,81,71,63,57,52,48,44,42,39,37,36,35,34,33,33,33,33,33,33,33,34,34,35,36,38,40,42,45,49,53,58,64,82,72,64,58,52,49,45,42,40,38,36,35,35,34,34,33,33,33,33,34,34,35,36,37,39,40,43,46,50,54,59,66,84,73,66,59,54,49,46,43,41,39,37,36,35,34,34,34,33,33,33,34,34,35,36,38,39,41,44,47,50,55,61,67,87,76,67,60,55,51,47,44,41,39,38,37,35,35,34,34,34,34,34,34,35,36,37,38,40,42,45,48,51,56,62,69,89,78,69,62,56,51,48,45,42,40,39,37,36,35,35,34,34,34,34,35,36,37,37,39,41,43,46,49,53,57,63,71,92,80,71,63,57,53,49,46,43,41,39,38,37,36,36,35,35,35,35,36,36,37,38,40,42,44,47,50,54,59,65,73,97,84,73,66,60,55,51,47,45,42,41,39,38,37,36,36,36,36,36,37,37,38,39,41,43,45,48,52,56,61,68,77,103,87,76,68,62,56,52,49,46,44,42,40,39,38,37,37,36,36,37,37,38,39,40,42,44,46,49,53,58,63,70,80};

// CALIBRATION_SHADING_LS_TL84_G
static uint8_t _calibration_shading_ls_tl84_g[]
 = {114,93,79,70,64,58,55,51,48,46,44,42,41,40,40,39,38,38,39,39,40,41,43,44,46,49,52,55,59,65,71,79,105,88,76,67,61,57,53,49,47,45,43,41,40,39,39,38,37,37,38,38,39,40,41,43,45,47,50,53,57,62,68,76,97,83,72,65,59,55,51,48,45,43,42,40,39,38,37,37,37,37,37,37,38,39,40,42,44,46,48,52,55,60,66,73,92,79,69,63,57,53,49,47,44,42,40,39,38,37,37,36,36,36,36,36,37,38,39,41,42,44,47,50,54,58,63,70,87,76,67,61,56,51,48,45,43,41,39,38,37,36,36,35,35,35,35,36,36,37,38,40,41,43,46,49,52,56,61,68,84,73,65,59,54,50,47,44,42,40,38,37,36,36,35,34,34,34,35,35,36,36,37,39,40,42,45,48,51,55,60,66,81,71,63,57,53,49,46,43,41,39,38,36,36,35,34,34,34,34,34,34,35,36,37,38,39,41,44,46,50,53,58,64,78,69,62,56,51,48,45,42,40,38,37,36,35,34,34,34,33,33,34,34,34,35,36,37,39,40,43,45,49,52,57,62,76,67,60,55,51,47,44,42,39,38,36,35,34,34,34,33,33,33,33,34,34,35,35,37,38,40,42,45,48,51,56,61,74,66,59,54,50,46,43,41,39,37,36,35,34,34,33,33,33,33,33,33,34,34,35,36,37,39,41,44,47,50,55,60,72,64,58,53,49,45,43,40,38,37,35,34,34,33,33,33,33,33,33,33,33,34,35,36,37,39,41,43,46,50,54,59,71,63,57,52,48,45,42,40,38,36,35,34,34,33,33,33,33,33,33,33,33,34,34,35,37,38,40,43,46,49,53,58,70,63,56,52,48,44,42,39,37,36,35,34,33,33,33,32,32,32,33,33,33,33,34,35,36,38,40,42,45,48,53,57,69,62,56,51,47,44,41,39,37,36,34,34,33,33,32,32,32,32,32,33,33,33,34,35,36,38,39,42,45,48,52,57,69,61,55,51,47,44,41,39,37,35,34,33,33,33,32,32,32,32,32,32,33,33,34,34,36,37,39,42,44,48,52,56,68,61,55,51,47,43,41,39,37,35,34,33,33,33,32,32,32,32,32,32,33,33,33,34,35,37,39,41,44,47,51,56,68,61,55,50,46,43,41,38,37,35,34,33,33,32,32,32,32,32,32,32,33,33,33,34,35,37,39,41,44,47,51,56,67,60,55,50,46,43,40,38,36,35,34,33,33,32,32,32,32,32,32,32,33,33,33,34,35,37,39,41,44,47,51,56,67,61,55,50,46,43,41,38,37,35,34,33,33,32,32,32,32,32,32,32,33,33,33,34,35,37,39,41,44,47,51,56,68,61,55,50,46,43,41,38,37,35,34,33,33,33,32,32,32,32,32,32,33,33,34,34,35,37,39,41,44,47,51,56,68,61,55,50,47,43,41,39,37,35,34,33,33,33,32,32,32,32,32,32,33,33,34,34,36,37,39,42,44,48,52,56,69,61,56,51,47,44,41,39,37,35,34,34,33,33,32,32,32,32,32,33,33,33,34,35,36,37,39,42,45,48,52,57,70,62,56,51,47,44,41,39,37,36,34,34,33,33,33,32,32,32,32,33,33,33,34,35,36,38,40,42,45,48,52,57,71,63,57,52,48,44,42,39,38,36,35,34,33,33,33,32,32,32,33,33,33,33,34,35,36,38,40,43,45,49,53,58,72,64,58,53,48,45,42,40,38,36,35,34,33,33,33,33,32,32,33,33,33,34,34,35,37,39,41,43,46,49,54,59,73,65,59,53,49,46,43,40,38,37,35,34,34,33,33,33,33,33,33,33,33,34,35,36,37,39,41,44,47,50,54,60,75,67,60,54,50,46,43,41,39,37,36,35,34,34,33,33,33,33,33,33,34,34,35,36,38,40,42,45,47,51,55,61,77,68,61,55,51,47,44,42,40,38,37,35,35,34,34,33,33,33,33,34,34,35,36,37,38,40,43,45,48,52,56,62,80,70,62,57,52,48,45,43,40,39,37,36,35,34,34,34,33,33,34,34,35,35,36,38,39,41,43,46,49,53,58,63,82,72,64,58,53,49,46,43,41,39,38,37,36,35,35,34,34,34,34,35,35,36,37,38,40,42,44,47,50,54,59,65,86,74,66,59,55,51,47,45,42,40,39,37,37,36,35,35,35,35,35,35,36,37,38,39,41,43,45,48,52,56,61,67,90,77,68,61,56,52,48,46,43,41,39,38,37,36,36,35,35,35,35,36,37,37,39,40,41,44,46,49,53,57,62,69};

// CALIBRATION_SHADING_LS_TL84_B
static uint8_t _calibration_shading_ls_tl84_b[]
 = {103,87,76,67,61,57,53,50,47,45,43,42,40,40,39,38,38,38,39,39,40,41,42,43,45,48,50,54,58,62,68,76,96,82,72,65,59,55,51,48,46,43,42,41,39,39,38,37,37,37,38,38,39,40,41,42,44,46,49,52,56,60,65,72,91,78,69,62,57,53,49,46,44,42,41,39,38,38,37,36,36,36,37,37,38,38,40,41,43,45,47,50,54,58,63,69,86,75,66,60,55,51,48,45,43,41,40,39,38,37,36,36,35,35,36,36,37,38,39,40,42,44,46,49,52,56,61,67,81,72,64,58,54,50,47,44,42,40,39,38,37,36,35,35,35,35,35,35,36,37,38,39,41,42,45,48,51,55,60,65,78,69,62,57,52,49,46,43,41,39,38,37,36,35,35,34,34,34,34,35,35,36,37,38,40,42,44,46,50,53,58,63,76,67,61,56,51,48,45,42,40,38,37,36,35,35,34,34,34,34,34,34,35,35,36,38,39,41,43,45,48,52,56,62,74,65,59,54,50,47,44,42,40,38,37,36,35,34,34,34,33,34,34,34,34,35,36,37,38,40,42,45,48,51,55,60,72,64,58,54,49,46,43,41,39,37,36,35,34,34,34,33,33,33,33,33,34,34,35,36,38,39,41,44,47,50,54,59,71,63,57,52,48,45,42,40,38,37,35,35,34,34,33,33,33,33,33,33,34,34,35,36,37,39,41,43,46,49,53,58,69,62,56,51,47,44,42,40,38,36,35,34,34,33,33,33,33,33,33,33,33,34,34,35,37,38,40,42,45,48,52,57,68,61,56,51,47,44,41,39,37,36,35,34,33,33,33,33,33,33,33,33,33,34,34,35,36,38,40,42,45,48,52,56,67,60,55,50,46,44,41,39,37,36,34,34,33,33,33,32,32,32,33,33,33,33,34,35,36,37,39,42,44,47,51,56,66,60,55,50,46,43,40,39,37,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,36,37,39,41,44,47,51,55,65,59,54,49,46,43,40,38,37,35,34,33,33,33,32,32,32,32,32,32,33,33,34,34,35,37,39,41,43,47,50,55,65,59,54,49,46,42,40,38,36,35,34,33,33,32,32,32,32,32,32,32,33,33,33,34,35,37,38,41,43,46,50,54,65,59,54,49,45,43,40,38,36,35,34,33,33,32,32,32,32,32,32,32,33,33,33,34,35,36,38,41,43,46,50,54,65,58,53,49,45,42,40,38,36,35,34,33,33,32,32,32,32,32,32,32,32,33,33,34,35,36,38,41,43,46,50,54,65,59,54,49,45,42,40,38,36,35,34,33,33,33,32,32,32,32,32,32,33,33,33,34,35,37,38,41,43,46,50,55,65,59,54,49,45,43,40,38,36,35,34,33,33,33,32,32,32,32,32,32,33,33,33,34,35,37,38,41,43,46,50,55,66,59,54,49,46,43,40,38,37,35,34,33,33,33,32,32,32,32,32,32,33,33,33,34,35,37,39,41,43,46,50,55,66,59,54,49,46,43,41,38,37,35,34,34,33,33,32,32,32,32,32,32,33,33,33,34,35,37,39,41,44,47,51,55,66,60,55,50,46,43,41,39,37,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,36,37,39,41,44,47,51,56,67,61,56,51,47,44,41,39,37,36,34,34,33,33,33,33,32,32,32,33,33,33,34,35,36,38,39,42,44,48,51,56,69,62,56,51,47,44,42,39,38,36,35,34,34,33,33,33,32,32,32,33,33,33,34,35,36,38,40,42,45,48,52,57,70,63,57,52,48,45,42,40,38,36,35,34,34,33,33,33,33,33,33,33,33,34,34,35,37,38,40,43,45,49,53,57,72,64,58,53,49,46,43,40,39,37,36,35,34,33,33,33,33,33,33,33,33,34,35,36,37,39,41,44,46,50,54,59,73,65,59,54,50,46,43,41,39,37,36,35,34,34,33,33,33,33,33,33,34,34,35,37,38,39,42,44,47,51,55,60,75,67,60,55,50,47,44,42,40,38,37,36,35,34,34,33,33,33,33,34,34,35,36,37,38,40,42,45,48,51,56,61,77,69,62,56,52,48,45,43,41,39,37,36,35,35,34,34,34,34,34,34,35,36,37,38,39,41,43,46,49,52,57,63,81,71,63,57,53,49,46,44,41,40,38,37,36,35,35,34,34,34,34,35,36,36,37,39,40,42,44,47,50,54,59,65,85,73,65,59,54,50,47,45,42,41,39,38,37,36,35,35,35,35,35,36,36,37,38,39,41,43,45,48,51,55,60,67};

// CALIBRATION_SHADING_LS_D65_R
static uint8_t _calibration_shading_ls_d65_r[]
 = {129,103,87,77,69,63,59,55,51,48,46,44,43,42,41,41,40,40,40,41,42,43,45,47,49,52,55,60,65,71,79,90,118,97,83,74,66,61,56,53,50,47,45,43,42,41,40,39,39,39,39,40,41,42,43,45,47,50,53,57,62,68,76,86,108,91,79,70,64,59,54,51,48,45,43,42,40,39,39,38,38,38,38,39,39,40,42,44,46,48,51,55,60,65,73,82,102,87,76,68,62,57,53,49,46,44,42,41,39,38,38,37,37,37,37,37,38,39,41,42,44,47,50,53,58,63,70,79,96,83,73,66,60,55,51,48,45,43,41,40,38,37,36,36,36,36,36,36,37,38,39,41,43,45,48,52,56,61,67,75,92,80,71,64,58,53,49,47,44,42,40,38,37,36,36,35,35,35,35,36,36,37,39,40,42,44,47,50,54,59,65,73,89,77,69,62,57,52,48,45,43,41,39,37,36,36,35,35,34,34,35,35,36,36,37,39,41,43,46,49,53,58,63,70,86,75,67,61,55,51,47,44,41,40,38,37,36,35,34,34,34,34,34,34,35,36,37,38,40,42,45,48,52,56,62,68,83,73,65,59,54,50,46,43,41,39,37,36,35,34,34,34,34,34,34,34,34,35,36,38,39,41,44,47,50,55,60,67,81,72,64,58,53,49,45,43,40,38,37,35,35,34,34,33,33,33,34,34,34,35,36,37,39,40,43,46,49,54,59,66,79,70,62,57,52,48,45,42,40,37,36,35,34,34,33,33,33,33,33,33,34,34,35,36,38,40,42,45,48,53,58,65,77,69,62,56,51,47,44,41,39,37,36,35,34,33,33,33,33,33,33,33,34,34,35,36,37,39,42,44,48,52,57,63,77,68,61,55,50,47,43,41,38,37,35,34,34,33,33,33,33,33,33,33,33,34,34,36,37,39,41,44,47,51,56,63,76,67,60,54,50,46,43,40,38,36,35,34,33,33,33,33,32,32,33,33,33,34,34,35,37,38,41,44,47,51,56,62,75,67,60,54,49,46,43,40,38,36,35,34,33,33,33,32,32,32,33,33,33,33,34,35,36,38,40,43,46,51,55,62,75,66,59,54,49,45,42,40,38,36,34,34,33,33,33,32,32,32,32,33,33,33,34,35,36,38,40,43,46,50,55,61,74,66,59,53,49,45,42,39,37,36,34,34,33,33,32,32,32,32,32,33,33,33,34,35,36,38,40,43,46,50,55,61,74,65,59,54,49,45,42,39,37,36,34,34,33,33,32,32,32,32,32,33,33,33,34,35,36,38,40,43,46,50,55,61,74,66,59,53,49,45,42,40,37,36,34,34,33,33,33,32,32,32,32,33,33,33,34,35,36,38,40,43,46,50,55,61,74,66,59,54,49,45,42,40,37,36,34,34,33,33,33,32,32,32,32,33,33,33,34,35,36,38,40,43,46,50,55,61,75,66,59,54,49,45,42,40,38,36,35,34,33,33,33,33,32,32,33,33,33,33,34,35,36,38,41,43,47,50,56,62,75,67,60,54,50,46,43,40,38,36,35,34,34,33,33,33,33,33,33,33,33,34,34,35,37,39,41,44,47,51,56,62,77,67,60,55,50,46,43,40,38,36,35,34,34,33,33,33,33,33,33,33,33,34,35,35,37,39,41,44,47,51,56,63,77,68,62,55,51,47,43,41,39,37,35,34,34,34,33,33,33,33,33,33,33,34,35,36,37,39,42,45,48,52,57,63,79,69,62,56,51,47,44,41,39,37,36,35,34,34,33,33,33,33,33,33,34,34,35,36,38,40,42,45,49,53,58,64,80,71,64,57,52,48,45,42,40,38,36,35,34,34,34,33,33,33,33,34,34,35,36,37,38,40,43,47,50,54,59,66,82,72,65,59,53,49,46,43,40,39,37,36,35,34,34,34,33,33,33,34,34,35,36,37,39,41,44,47,50,55,60,67,85,74,66,60,54,50,47,44,41,39,38,36,35,35,34,34,34,34,34,34,35,36,37,38,40,42,45,48,51,56,61,68,88,77,68,61,56,51,47,45,42,40,38,37,36,35,35,34,34,34,34,35,36,36,38,39,41,43,46,49,52,57,63,69,91,79,70,63,57,53,48,46,43,41,39,38,37,36,36,35,35,35,35,36,36,37,38,40,42,44,47,50,54,59,64,72,94,81,72,65,59,54,50,47,44,42,40,39,38,37,36,36,36,36,36,36,37,38,39,41,43,45,48,51,55,61,67,74,98,84,74,67,60,55,52,48,46,43,41,40,39,38,37,37,36,36,37,37,38,39,40,42,43,46,49,53,57,63,70,78};

// CALIBRATION_SHADING_LS_D65_G
static uint8_t _calibration_shading_ls_d65_g[]
 = {112,92,78,69,63,58,54,51,48,46,44,42,41,40,39,39,38,38,39,39,40,41,43,44,46,49,52,55,59,64,71,80,103,87,75,67,61,56,52,49,47,44,42,41,40,39,38,38,37,37,38,38,39,40,41,43,45,47,50,53,57,62,68,76,96,82,71,64,59,54,51,48,45,43,41,40,39,38,37,37,36,36,37,37,38,39,40,42,43,46,48,51,55,60,66,73,91,78,69,62,57,53,49,46,44,42,40,39,38,37,36,36,36,36,36,36,37,38,39,41,42,44,47,50,54,58,63,70,86,75,66,60,55,51,48,45,43,41,39,38,37,36,36,35,35,35,35,36,36,37,38,40,41,43,46,49,52,56,61,68,82,72,64,58,54,50,47,44,42,40,38,37,36,35,35,34,34,34,34,35,35,36,37,39,40,42,45,47,51,55,60,65,80,70,63,57,52,49,45,43,41,39,37,36,35,35,34,34,34,34,34,34,35,36,37,38,40,41,44,46,50,54,58,64,77,68,61,56,51,48,44,42,40,38,37,36,35,34,34,33,33,33,34,34,34,35,36,37,39,41,43,45,49,52,57,62,75,67,60,54,50,47,44,41,39,38,36,35,34,34,33,33,33,33,33,33,34,34,35,37,38,40,42,45,48,51,56,61,73,65,59,53,49,46,43,41,39,37,36,35,34,33,33,33,33,33,33,33,34,34,35,36,37,39,41,44,47,50,55,60,71,64,58,53,49,45,42,40,38,36,35,34,34,33,33,33,33,33,33,33,33,34,35,36,37,39,41,43,46,50,54,59,70,63,57,52,48,45,42,40,38,36,35,34,33,33,33,33,33,33,33,33,33,34,34,35,37,38,40,43,46,49,53,58,70,62,56,51,47,44,41,39,37,36,34,34,33,33,33,32,32,32,33,33,33,33,34,35,36,38,40,42,45,48,52,57,69,61,56,51,47,44,41,39,37,35,34,34,33,33,32,32,32,32,32,33,33,33,34,35,36,38,40,42,45,48,52,57,68,61,55,50,47,43,41,39,37,35,34,33,33,33,32,32,32,32,32,32,33,33,34,34,36,37,39,42,44,48,52,56,67,61,55,50,46,43,40,38,36,35,34,33,33,32,32,32,32,32,32,32,33,33,33,34,36,37,39,41,44,47,51,56,67,60,55,50,46,43,40,38,36,35,34,33,33,32,32,32,32,32,32,32,33,33,33,34,35,37,39,41,44,47,51,56,67,60,54,50,46,43,40,38,36,35,34,33,33,32,32,32,32,32,32,32,33,33,33,34,35,37,39,41,44,47,51,56,67,60,54,50,46,43,40,38,36,35,34,33,33,32,32,32,32,32,32,32,33,33,33,34,35,37,39,41,44,47,51,56,67,60,55,50,46,43,41,38,36,35,34,33,33,33,32,32,32,32,32,32,33,33,34,34,35,37,39,41,44,47,51,56,68,61,55,50,46,43,41,38,37,35,34,33,33,33,32,32,32,32,32,32,33,33,34,34,36,37,39,42,44,48,51,56,68,61,55,50,47,43,41,39,37,35,34,34,33,33,33,32,32,32,32,33,33,33,34,34,36,38,39,42,45,48,52,57,69,62,56,51,47,44,41,39,37,36,34,34,33,33,33,32,32,32,32,33,33,33,34,35,36,38,40,42,45,48,52,57,70,62,57,52,47,44,42,39,37,36,35,34,33,33,33,33,32,32,32,33,33,33,34,35,36,38,40,43,45,49,53,58,71,63,57,52,48,45,42,40,38,36,35,34,33,33,33,33,33,32,33,33,33,34,34,35,37,38,41,43,46,49,53,58,73,65,58,53,49,45,43,40,38,37,35,34,34,33,33,33,33,33,33,33,33,34,35,36,37,39,41,44,47,50,54,59,74,66,59,54,49,46,43,41,39,37,36,35,34,34,33,33,33,33,33,33,34,34,35,36,38,40,42,44,47,51,55,60,77,67,60,55,51,47,44,42,40,38,36,35,35,34,34,33,33,33,33,34,34,35,36,37,38,40,43,45,48,52,56,62,79,69,62,56,52,48,45,42,40,39,37,36,35,34,34,34,33,33,34,34,35,36,36,38,39,41,43,46,49,53,58,63,81,71,63,57,53,49,46,43,41,39,38,37,36,35,35,34,34,34,34,35,35,36,37,38,40,42,44,47,50,54,59,65,85,74,65,59,54,50,47,44,42,40,39,37,36,36,35,35,35,35,35,35,36,37,38,39,41,43,45,48,51,56,61,67,89,76,67,61,56,51,48,45,43,41,39,38,37,36,36,35,35,35,35,36,37,37,39,40,42,44,46,49,53,57,62,69};

// CALIBRATION_SHADING_LS_D65_B
static uint8_t _calibration_shading_ls_d65_b[]
 = {103,87,76,67,61,56,52,49,47,44,43,41,40,40,39,38,38,38,38,39,40,40,42,43,45,47,50,53,57,62,69,76,96,82,72,64,59,54,51,48,45,43,42,40,39,39,38,37,37,37,37,38,39,39,41,42,44,46,49,51,55,60,66,73,90,78,68,62,57,52,49,46,44,42,40,39,38,37,37,36,36,36,37,37,38,38,40,41,43,45,47,50,53,58,63,70,85,74,66,60,55,51,48,45,43,41,40,38,37,37,36,36,35,35,36,36,37,38,39,40,42,43,46,49,52,56,61,68,81,71,64,58,53,49,46,44,42,40,39,38,37,36,35,35,35,35,35,35,36,37,38,39,41,43,45,48,51,54,60,66,78,69,62,56,52,48,45,43,41,39,38,37,36,35,35,34,34,34,34,35,35,36,37,38,40,42,44,46,49,53,58,64,75,67,60,55,51,47,44,42,40,38,37,36,35,35,34,34,34,34,34,34,35,35,36,38,39,41,43,45,48,52,56,62,73,65,59,54,50,46,43,41,39,38,37,36,35,34,34,33,33,33,34,34,34,35,36,37,38,40,42,45,48,51,55,61,72,64,58,53,49,46,43,41,39,37,36,35,34,34,34,33,33,33,33,34,34,34,35,36,38,39,41,44,47,50,54,59,70,63,57,52,48,45,42,40,38,37,35,35,34,34,33,33,33,33,33,33,34,34,35,36,37,39,41,43,46,49,53,58,69,62,56,51,47,44,42,40,38,36,35,34,34,33,33,33,33,33,33,33,34,34,34,35,37,38,40,43,45,48,52,57,67,60,55,50,47,44,41,39,37,36,35,34,33,33,33,33,33,33,33,33,33,34,34,35,36,38,40,42,45,48,52,56,67,60,54,50,46,43,41,39,37,36,34,34,33,33,33,33,32,33,33,33,33,33,34,35,36,37,39,42,44,47,51,55,66,60,54,50,46,43,41,38,37,35,34,34,33,33,32,32,32,32,32,33,33,33,34,35,36,37,39,41,44,47,50,55,66,59,53,49,46,43,40,38,36,35,34,33,33,33,32,32,32,32,32,33,33,33,34,34,35,37,39,41,43,47,50,54,65,59,53,49,45,42,40,38,36,35,34,33,33,33,32,32,32,32,32,32,33,33,33,34,35,37,38,41,43,46,50,54,65,58,53,49,45,42,40,38,36,35,34,33,33,33,32,32,32,32,32,32,33,33,33,34,35,37,38,41,43,46,50,54,65,58,53,49,45,42,40,38,36,35,34,33,33,33,32,32,32,32,32,32,33,33,33,34,35,36,38,41,43,46,50,54,64,58,53,49,45,42,40,38,36,35,34,33,33,32,32,32,32,32,32,32,33,33,33,34,35,37,38,41,43,46,50,54,65,58,53,49,45,42,40,38,36,35,34,33,33,33,32,32,32,32,32,32,33,33,33,34,35,37,38,41,43,46,50,54,65,58,53,49,45,42,40,38,36,35,34,33,33,33,32,32,32,32,32,32,33,33,33,34,35,37,39,41,43,46,50,55,66,59,53,49,46,43,40,38,37,35,34,34,33,33,32,32,32,32,32,33,33,33,34,34,35,37,39,41,44,47,50,55,66,59,54,50,46,43,41,38,37,35,34,33,33,33,33,32,32,32,32,33,33,33,34,34,36,37,39,41,44,47,51,55,67,61,55,50,46,44,41,39,37,36,35,34,33,33,33,32,32,32,33,33,33,33,34,35,36,38,39,42,44,48,51,56,68,61,56,51,47,44,41,39,37,36,35,34,34,33,33,33,33,32,33,33,33,33,34,35,36,38,40,42,45,48,52,57,69,62,57,52,48,44,42,40,38,36,35,34,34,33,33,33,33,33,33,33,33,34,34,35,37,38,40,43,45,49,53,57,71,63,57,53,48,45,43,40,38,37,36,35,34,33,33,33,33,33,33,33,33,34,35,36,37,39,41,43,46,49,54,59,73,65,58,54,49,46,43,41,39,37,36,35,34,34,33,33,33,33,33,33,34,35,35,36,38,39,41,44,47,50,54,60,75,66,60,55,50,47,44,42,40,38,37,36,35,34,34,34,33,33,33,34,34,35,36,37,38,40,42,45,48,51,56,61,77,68,62,56,51,48,45,42,40,39,37,36,35,35,34,34,34,34,34,34,35,36,37,38,39,41,43,46,49,52,57,63,80,71,63,57,53,49,46,43,41,39,38,37,36,35,35,35,34,34,34,35,36,36,37,38,40,42,44,47,50,54,58,64,84,74,65,59,54,50,47,44,42,40,39,38,37,36,36,35,35,35,35,35,36,37,38,39,41,43,45,48,51,55,60,66};

// R G B
static uint16_t _calibration_awb_warming_ls_a[] = {265, 256, 259};

// R G B
static uint16_t _calibration_awb_warming_ls_d75[] = {270, 256, 270};

// R G B
static uint16_t _calibration_awb_warming_ls_d50[] = {270, 256, 266};

// CALIBRATION_NOISE_PROFILE
static uint8_t _calibration_noise_profile[]
 = {0,0,0,0,0,0,0,2,38,51,56,60,62,65,66,68,69,71,72,73,74,75,75,76,77,78,78,79,79,80,80,81,81,82,82,83,83,83,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85};

// CALIBRATION_DEMOSAIC
static uint8_t _calibration_demosaic[]
 = {1,17,27,31,34,37,39,41,42,44,45,46,47,48,49,50,51,51,52,53,53,53,54,55,55,56,56,57,57,57,58,58,59,59,59,60,60,60,61,61,61,61,62,62,62,62,63,63,63,63,64,64,64,64,65,65,65,65,65,66,66,66,66,66,67,67,67,67,67,67,68,68,68,68,68,68,68,69,69,69,69,69,69,70,70,70,70,70,70,70,70,71,71,71,71,71,71,71,71,72,72,72,72,72,72,72,72,72,73,73,73,73,73,73,73,73,73,73,74,74,74,74,74,74,74,74,74,74};

// 8-bit normalised noise profile for WDR stitching
static uint8_t _calibration_wdr_np_lut[]
 = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

// CALIBRATION_GAMMA
static uint16_t _calibration_gamma[]
 = {0,347,539,679,794,894,982,1062,1136,1204,1268,1329,1386,1441,1493,1543,1591,1638,1683,1726,1768,1809,1849,1888,1926,1963,1999,2034,2068,2102,2135,2168,2200,2231,2262,2292,2322,2351,2380,2408,2436,2463,2491,2517,2544,2570,2596,2621,2646,2671,2695,2719,2743,2767,2790,2814,2836,2859,2882,2904,2926,2948,2969,2990,3012,3033,3053,3074,3094,3115,3135,3155,3174,3194,3213,3233,3252,3271,3290,3308,3327,3345,3364,3382,3400,3418,3436,3453,3471,3488,3506,3523,3540,3557,3574,3591,3607,3624,3640,3657,3673,3689,3705,3721,3737,3753,3769,3785,3800,3816,3831,3846,3862,3877,3892,3907,3922,3937,3951,3966,3981,3995,4010,4024,4039,4053,4067,4081,4095};

// CALIBRATION_IRIDIX_ASYMMETRY
static uint32_t _calibration_iridix_asymmetry[]
 = {0,62836,120267,172961,221481,266305,307839,346432,382386,415964,447392,476871,504577,530666,555274,578524,600526,621378,641167,659973,677867,694914,711172,726696,741534,755730,769325,782356,794859,806864,818400,829495,840173,850457,860369,869929,879155,888064,896672,904994,913045,920837,928383,935693,942780,949653,956321,962794,969080,975187,981123,986894,992508,997970,1003288,1008466,1013509,1018424,1023215,1027887,1032443,1036889,1041228,1045464,1048575};

static uint32_t _calibration_ca_filter_mem[]
 = {32768,229629,491259,4278943225,4279204855,4262689525,4246239220,4229788915,4213338610,4196888050,4197214450,4180763890,4164313330,4147928050,4131477235,4115091955,4098641140,4082190325,4082516470,4066065655,4066391800,4066652665,4066913530,4067239930,4067500795,4084473340,4101445885,4118418430,4152037375,4185721855,4219340544,4253025024};

// calibration_awb_scene_presets in the following order AWB_DAY_LIGHT AWB_CLOUDY AWB_INCANDESCENT AWB_FLOURESCENT AWB_TWILIGHT AWB_SHADE AWB_WARM_FLOURESCENT
static uint16_t _calibration_awb_scene_presets[7][2] = {
  { 256, 256 },
  { 318, 218 },
  { 182, 386 },
  { 226, 286 },
  { 226, 286 },
  { 358, 196 },
  { 189, 358 }
};

// CALIBRATION_CA_CORRECTION: MIN_CORRECTION, MESH_WIDTH, MESH_HEIGHT
static uint16_t _calibration_ca_correction[] = {1, 64, 64};

static uint16_t _calibration_ca_correction_mem[][10] = {
  { 65508, 65535, 65528, 65533, 44, 10, 9, 65530, 65529, 65521 },
  { 65529, 65521, 1, 2, 17, 15, 65535, 65524, 6, 65527 },
  { 23, 65531, 5, 65532, 65506, 65535, 3, 30, 1, 65490 },
  { 4, 14, 65529, 5, 65525, 65529, 65531, 7, 13, 65508 }};

static uint32_t _calibration_lut3d_mem[] = {0};

static uint32_t _calibration_decompander0_mem[] = {0, 32768, 65536, 98304, 131072, 163840, 196608, 229376, 262144, 294912, 327680, 360448, 393216, 425984, 458752, 491520, 524288, 557055, 589823, 622591, 655359, 688127, 720895, 753663, 786431, 819199, 851967, 884735, 917503, 950271, 983039, 1015807, 1048575};

static uint32_t _calibration_decompander1_mem[] = {0, 4096, 8192, 12288, 16384, 20480, 24576, 28672, 32768, 36864, 40960, 45056, 49152, 53248, 57344, 61440, 65536, 69632, 73728, 77824, 81920, 86016, 90112, 94208, 98304, 102400, 106496, 110592, 114688, 118784, 122880, 126976, 131072, 135168, 139264, 143360, 147456, 151552, 155648, 159744, 163840, 167936, 172032, 176128, 180224, 184320, 188416, 192512, 196608, 200704, 204800, 208896, 212992, 217088, 221184, 225280, 229376, 233472, 237568, 241664, 245760, 249856, 253952, 258048, 262144, 266240, 270336, 274432, 278528, 282624, 286720, 290816, 294912, 299008, 303104, 307200, 311296, 315392, 319488, 323584, 327680, 331776, 335872, 339968, 344064, 348160, 352256, 356352, 360448, 364544, 368640, 372736, 376832, 380928, 385024, 389120, 393216, 397312, 401408, 405504, 409600, 413696, 417792, 421888, 425984, 430080, 434176, 438272, 442368, 446464, 450560, 454656, 458752, 462848, 466944, 471040, 475136, 479232, 483328, 487424, 491520, 495616, 499712, 503808, 507904, 512000, 516096, 520192, 524288, 528383, 532479, 536575, 540671, 544767, 548863, 552959, 557055, 561151, 565247, 569343, 573439, 577535, 581631, 585727, 589823, 593919, 598015, 602111, 606207, 610303, 614399, 618495, 622591, 626687, 630783, 634879, 638975, 643071, 647167, 651263, 655359, 659455, 663551, 667647, 671743, 675839, 679935, 684031, 688127, 692223, 696319, 700415, 704511, 708607, 712703, 716799, 720895, 724991, 729087, 733183, 737279, 741375, 745471, 749567, 753663, 757759, 761855, 765951, 770047, 774143, 778239, 782335, 786431, 790527, 794623, 798719, 802815, 806911, 811007, 815103, 819199, 823295, 827391, 831487, 835583, 839679, 843775, 847871, 851967, 856063, 860159, 864255, 868351, 872447, 876543, 880639, 884735, 888831, 892927, 897023, 901119, 905215, 909311, 913407, 917503, 921599, 925695, 929791, 933887, 937983, 942079, 946175, 950271, 954367, 958463, 962559, 966655, 970751, 974847, 978943, 983039, 987135, 991231, 995327, 999423, 1003519, 1007615, 1011711, 1015807, 1019903, 1023999, 1028095, 1032191, 1036287, 1040383, 1044479, 1048575};

// CALIBRATION_SHADING_RADIAL_R
static uint16_t _calibration_shading_radial_r[] = {4096,4098,4099,4101,4103,4104,4106,4108,4110,4112,4114,4116,4118,4120,4122,4124,4126,4128,4131,4133,4136,4138,4141,4144,4146,4149,4152,4155,4158,4161,4165,4168,4171,4175,4178,4182,4186,4190,4194,4198,4202,4206,4211,4215,4220,4225,4229,4234,4239,4245,4250,4255,4261,4266,4272,4278,4284,4290,4296,4303,4309,4316,4323,4329,4336,4344,4351,4358,4366,4373,4381,4389,4397,4405,4413,4422,4430,4439,4448,4457,4466,4475,4485,4494,4504,4514,4524,4534,4544,4554,4565,4575,4586,4597,4608,4619,4630,4642,4653,4665,4677,4688,4700,4713,4725,4737,4750,4762,4775,4788,4800,4813,4826,4840,4853,4866,4880,4893,4907,4920,4934,4948,4962,4976,4990,5004,5018,5032,5046};

// CALIBRATION_SHADING_RADIAL_G
static uint16_t _calibration_shading_radial_g[] = {4096,4098,4099,4100,4102,4103,4105,4106,4108,4109,4111,4112,4114,4115,4117,4119,4120,4122,4124,4125,4127,4129,4131,4133,4135,4137,4140,4142,4144,4147,4149,4152,4155,4158,4161,4164,4167,4170,4173,4177,4180,4184,4188,4192,4196,4200,4204,4208,4213,4217,4222,4227,4232,4237,4242,4248,4253,4259,4265,4271,4277,4283,4290,4296,4303,4310,4317,4324,4332,4339,4347,4355,4363,4371,4379,4387,4396,4405,4414,4423,4432,4441,4451,4460,4470,4480,4490,4501,4511,4522,4533,4544,4555,4566,4577,4589,4601,4612,4624,4636,4649,4661,4673,4686,4699,4712,4725,4738,4751,4764,4778,4791,4805,4819,4832,4846,4860,4874,4888,4902,4916,4930,4945,4959,4973,4987,5001,5016,5030};

// CALIBRATION_SHADING_RADIAL_B
static uint16_t _calibration_shading_radial_b[] = {4096,4097,4098,4099,4100,4101,4101,4102,4103,4104,4105,4106,4107,4108,4108,4109,4110,4111,4113,4114,4115,4116,4117,4119,4120,4122,4123,4125,4127,4128,4130,4132,4134,4136,4139,4141,4143,4146,4148,4151,4154,4157,4160,4163,4166,4170,4173,4177,4181,4185,4189,4193,4197,4202,4206,4211,4216,4221,4226,4231,4237,4242,4248,4254,4260,4266,4272,4279,4286,4292,4299,4306,4314,4321,4328,4336,4344,4352,4360,4368,4377,4386,4394,4403,4412,4422,4431,4440,4450,4460,4470,4480,4490,4501,4511,4522,4533,4544,4555,4566,4577,4589,4600,4612,4624,4636,4648,4660,4672,4684,4697,4709,4722,4734,4747,4760,4773,4786,4798,4811,4824,4837,4850,4863,4876,4889,4902,4915,4928};

static LookupTable calibration_shading_radial_r = { .ptr = _calibration_shading_radial_r, .rows = 1, .cols = sizeof(_calibration_shading_radial_r) / sizeof(_calibration_shading_radial_r[0]), .width = sizeof(_calibration_shading_radial_r[0] ) };
static LookupTable calibration_shading_radial_g = { .ptr = _calibration_shading_radial_g, .rows = 1, .cols = sizeof(_calibration_shading_radial_g) / sizeof(_calibration_shading_radial_g[0]), .width = sizeof(_calibration_shading_radial_g[0] ) };
static LookupTable calibration_shading_radial_b = { .ptr = _calibration_shading_radial_b, .rows = 1, .cols = sizeof(_calibration_shading_radial_b) / sizeof(_calibration_shading_radial_b[0]), .width = sizeof(_calibration_shading_radial_b[0] ) };
static LookupTable calibration_decompander0_mem = {.ptr = _calibration_decompander0_mem, .rows = 1, .cols = sizeof( _calibration_decompander0_mem ) / sizeof( _calibration_decompander0_mem[0] ), .width = sizeof( _calibration_decompander0_mem[0] )};
static LookupTable calibration_decompander1_mem = {.ptr = _calibration_decompander1_mem, .rows = 1, .cols = sizeof( _calibration_decompander1_mem ) / sizeof( _calibration_decompander1_mem[0] ), .width = sizeof( _calibration_decompander1_mem[0] )};

static LookupTable calibration_awb_scene_presets = {.ptr = _calibration_awb_scene_presets, .cols = 2, .rows = sizeof( _calibration_awb_scene_presets ) / sizeof( _calibration_awb_scene_presets[0] ), .width = sizeof( _calibration_awb_scene_presets[0][0] )};
static LookupTable calibration_light_src = {.ptr = _calibration_light_src, .cols = 2, .rows = sizeof( _calibration_light_src ) / sizeof( _calibration_light_src[0] ), .width = sizeof( _calibration_light_src[0][0] )};
static LookupTable calibration_rg_pos = {.ptr = _calibration_rg_pos, .rows = 1, .cols = sizeof( _calibration_rg_pos ) / sizeof( _calibration_rg_pos[0] ), .width = sizeof( _calibration_rg_pos[0] )};
static LookupTable calibration_bg_pos = {.ptr = _calibration_bg_pos, .rows = 1, .cols = sizeof( _calibration_bg_pos ) / sizeof( _calibration_bg_pos[0] ), .width = sizeof( _calibration_bg_pos[0] )};
static LookupTable calibration_mesh_rgbg_weight = {.ptr = _calibration_mesh_rgbg_weight, .cols = 15, .rows = sizeof( _calibration_mesh_rgbg_weight ) / sizeof( _calibration_mesh_rgbg_weight[0] ), .width = sizeof( _calibration_mesh_rgbg_weight[0][0] )};
static LookupTable calibration_mesh_ls_weight = {.ptr = _calibration_mesh_ls_weight, .cols = 15, .rows = sizeof( _calibration_mesh_ls_weight ) / sizeof( _calibration_mesh_ls_weight[0] ), .width = sizeof( _calibration_mesh_ls_weight[0][0] )};
static LookupTable calibration_mesh_color_temperature = {.ptr = _calibration_mesh_color_temperature, .cols = 15, .rows = sizeof( _calibration_mesh_color_temperature ) / sizeof( _calibration_mesh_color_temperature[0] ), .width = sizeof( _calibration_mesh_color_temperature[0][0] )};
static LookupTable calibration_wb_strength = {.ptr = _calibration_wb_strength, .rows = 1, .cols = sizeof( _calibration_wb_strength ) / sizeof( _calibration_wb_strength[0] ), .width = sizeof( _calibration_wb_strength[0] )};
static LookupTable calibration_sky_lux_th = {.ptr = _calibration_sky_lux_th, .rows = 1, .cols = sizeof( _calibration_sky_lux_th ) / sizeof( _calibration_sky_lux_th[0] ), .width = sizeof( _calibration_sky_lux_th[0] )};
static LookupTable calibration_ct_rg_pos_calc = {.ptr = _calibration_ct_rg_pos_calc, .rows = 1, .cols = sizeof( _calibration_ct_rg_pos_calc ) / sizeof( _calibration_ct_rg_pos_calc[0] ), .width = sizeof( _calibration_ct_rg_pos_calc[0] )};
static LookupTable calibration_ct_bg_pos_calc = {.ptr = _calibration_ct_bg_pos_calc, .rows = 1, .cols = sizeof( _calibration_ct_bg_pos_calc ) / sizeof( _calibration_ct_bg_pos_calc[0] ), .width = sizeof( _calibration_ct_bg_pos_calc[0] )};
static LookupTable calibration_color_temp = {.ptr = _calibration_color_temp, .rows = 1, .cols = sizeof( _calibration_color_temp ) / sizeof( _calibration_color_temp[0] ), .width = sizeof( _calibration_color_temp[0] )};
static LookupTable calibration_ct65pos = {.ptr = _calibration_ct65pos, .rows = 1, .cols = sizeof( _calibration_ct65pos ) / sizeof( _calibration_ct65pos[0] ), .width = sizeof( _calibration_ct65pos[0] )};
static LookupTable calibration_ct40pos = {.ptr = _calibration_ct40pos, .rows = 1, .cols = sizeof( _calibration_ct40pos ) / sizeof( _calibration_ct40pos[0] ), .width = sizeof( _calibration_ct40pos[0] )};
static LookupTable calibration_ct30pos = {.ptr = _calibration_ct30pos, .rows = 1, .cols = sizeof( _calibration_ct30pos ) / sizeof( _calibration_ct30pos[0] ), .width = sizeof( _calibration_ct30pos[0] )};
static LookupTable calibration_evtolux_ev_lut = {.ptr = _calibration_evtolux_ev_lut, .rows = 1, .cols = sizeof( _calibration_evtolux_ev_lut ) / sizeof( _calibration_evtolux_ev_lut[0] ), .width = sizeof( _calibration_evtolux_ev_lut[0] )};
static LookupTable calibration_evtolux_lux_lut = {.ptr = _calibration_evtolux_lux_lut, .rows = 1, .cols = sizeof( _calibration_evtolux_lux_lut ) / sizeof( _calibration_evtolux_lux_lut[0] ), .width = sizeof( _calibration_evtolux_lux_lut[0] )};
static LookupTable calibration_black_level_r = {.ptr = _calibration_black_level_r, .cols = 2, .rows = sizeof( _calibration_black_level_r ) / sizeof( _calibration_black_level_r[0] ), .width = sizeof( _calibration_black_level_r[0][0] )};
static LookupTable calibration_black_level_gr = {.ptr = _calibration_black_level_gr, .cols = 2, .rows = sizeof( _calibration_black_level_gr ) / sizeof( _calibration_black_level_gr[0] ), .width = sizeof( _calibration_black_level_gr[0][0] )};
static LookupTable calibration_black_level_gb = {.ptr = _calibration_black_level_gb, .cols = 2, .rows = sizeof( _calibration_black_level_gb ) / sizeof( _calibration_black_level_gb[0] ), .width = sizeof( _calibration_black_level_gb[0][0] )};
static LookupTable calibration_black_level_b = {.ptr = _calibration_black_level_b, .cols = 2, .rows = sizeof( _calibration_black_level_b ) / sizeof( _calibration_black_level_b[0] ), .width = sizeof( _calibration_black_level_b[0][0] )};
static LookupTable calibration_static_wb = {.ptr = _calibration_static_wb, .rows = 1, .cols = sizeof( _calibration_static_wb ) / sizeof( _calibration_static_wb[0] ), .width = sizeof( _calibration_static_wb[0] )};
static LookupTable calibration_mt_absolute_ls_a_ccm = {.ptr = _calibration_mt_absolute_ls_a_ccm, .rows = 1, .cols = sizeof( _calibration_mt_absolute_ls_a_ccm ) / sizeof( _calibration_mt_absolute_ls_a_ccm[0] ), .width = sizeof( _calibration_mt_absolute_ls_a_ccm[0] )};
static LookupTable calibration_mt_absolute_ls_d40_ccm = {.ptr = _calibration_mt_absolute_ls_d40_ccm, .rows = 1, .cols = sizeof( _calibration_mt_absolute_ls_d40_ccm ) / sizeof( _calibration_mt_absolute_ls_d40_ccm[0] ), .width = sizeof( _calibration_mt_absolute_ls_d40_ccm[0] )};
static LookupTable calibration_mt_absolute_ls_d50_ccm = {.ptr = _calibration_mt_absolute_ls_d50_ccm, .rows = 1, .cols = sizeof( _calibration_mt_absolute_ls_d50_ccm ) / sizeof( _calibration_mt_absolute_ls_d50_ccm[0] ), .width = sizeof( _calibration_mt_absolute_ls_d50_ccm[0] )};
static LookupTable calibration_shading_ls_a_r = {.ptr = _calibration_shading_ls_a_r, .rows = 1, .cols = sizeof( _calibration_shading_ls_a_r ) / sizeof( _calibration_shading_ls_a_r[0] ), .width = sizeof( _calibration_shading_ls_a_r[0] )};
static LookupTable calibration_shading_ls_a_g = {.ptr = _calibration_shading_ls_a_g, .rows = 1, .cols = sizeof( _calibration_shading_ls_a_g ) / sizeof( _calibration_shading_ls_a_g[0] ), .width = sizeof( _calibration_shading_ls_a_g[0] )};
static LookupTable calibration_shading_ls_a_b = {.ptr = _calibration_shading_ls_a_b, .rows = 1, .cols = sizeof( _calibration_shading_ls_a_b ) / sizeof( _calibration_shading_ls_a_b[0] ), .width = sizeof( _calibration_shading_ls_a_b[0] )};
static LookupTable calibration_shading_ls_tl84_r = {.ptr = _calibration_shading_ls_tl84_r, .rows = 1, .cols = sizeof( _calibration_shading_ls_tl84_r ) / sizeof( _calibration_shading_ls_tl84_r[0] ), .width = sizeof( _calibration_shading_ls_tl84_r[0] )};
static LookupTable calibration_shading_ls_tl84_g = {.ptr = _calibration_shading_ls_tl84_g, .rows = 1, .cols = sizeof( _calibration_shading_ls_tl84_g ) / sizeof( _calibration_shading_ls_tl84_g[0] ), .width = sizeof( _calibration_shading_ls_tl84_g[0] )};
static LookupTable calibration_shading_ls_tl84_b = {.ptr = _calibration_shading_ls_tl84_b, .rows = 1, .cols = sizeof( _calibration_shading_ls_tl84_b ) / sizeof( _calibration_shading_ls_tl84_b[0] ), .width = sizeof( _calibration_shading_ls_tl84_b[0] )};
static LookupTable calibration_shading_ls_d65_r = {.ptr = _calibration_shading_ls_d65_r, .rows = 1, .cols = sizeof( _calibration_shading_ls_d65_r ) / sizeof( _calibration_shading_ls_d65_r[0] ), .width = sizeof( _calibration_shading_ls_d65_r[0] )};
static LookupTable calibration_shading_ls_d65_g = {.ptr = _calibration_shading_ls_d65_g, .rows = 1, .cols = sizeof( _calibration_shading_ls_d65_g ) / sizeof( _calibration_shading_ls_d65_g[0] ), .width = sizeof( _calibration_shading_ls_d65_g[0] )};
static LookupTable calibration_shading_ls_d65_b = {.ptr = _calibration_shading_ls_d65_b, .rows = 1, .cols = sizeof( _calibration_shading_ls_d65_b ) / sizeof( _calibration_shading_ls_d65_b[0] ), .width = sizeof( _calibration_shading_ls_d65_b[0] )};
static LookupTable calibration_awb_warming_ls_a = {.ptr = _calibration_awb_warming_ls_a, .rows = 1, .cols = sizeof( _calibration_awb_warming_ls_a ) / sizeof( _calibration_awb_warming_ls_a[0] ), .width = sizeof( _calibration_awb_warming_ls_a[0] )};
static LookupTable calibration_awb_warming_ls_d50 = {.ptr = _calibration_awb_warming_ls_d50, .rows = 1, .cols = sizeof( _calibration_awb_warming_ls_d50 ) / sizeof( _calibration_awb_warming_ls_d50[0] ), .width = sizeof( _calibration_awb_warming_ls_d50[0] )};
static LookupTable calibration_awb_warming_ls_d75 = {.ptr = _calibration_awb_warming_ls_d75, .rows = 1, .cols = sizeof( _calibration_awb_warming_ls_d75 ) / sizeof( _calibration_awb_warming_ls_d75[0] ), .width = sizeof( _calibration_awb_warming_ls_d75[0] )};
static LookupTable calibration_noise_profile = {.ptr = _calibration_noise_profile, .rows = 1, .cols = sizeof( _calibration_noise_profile ) / sizeof( _calibration_noise_profile[0] ), .width = sizeof( _calibration_noise_profile[0] )};
static LookupTable calibration_demosaic = {.ptr = _calibration_demosaic, .rows = 1, .cols = sizeof( _calibration_demosaic ) / sizeof( _calibration_demosaic[0] ), .width = sizeof( _calibration_demosaic[0] )};
static LookupTable calibration_wdr_np_lut = {.ptr = _calibration_wdr_np_lut, .rows = 1, .cols = sizeof( _calibration_wdr_np_lut ) / sizeof( _calibration_wdr_np_lut[0] ), .width = sizeof( _calibration_wdr_np_lut[0] )};
static LookupTable calibration_gamma = {.ptr = _calibration_gamma, .rows = 1, .cols = sizeof( _calibration_gamma ) / sizeof( _calibration_gamma[0] ), .width = sizeof( _calibration_gamma[0] )};
static LookupTable calibration_iridix_asymmetry = {.ptr = _calibration_iridix_asymmetry, .rows = 1, .cols = sizeof( _calibration_iridix_asymmetry ) / sizeof( _calibration_iridix_asymmetry[0] ), .width = sizeof( _calibration_iridix_asymmetry[0] )};
static LookupTable calibration_ca_filter_mem = {.ptr = _calibration_ca_filter_mem, .rows = 1, .cols = sizeof( _calibration_ca_filter_mem ) / sizeof( _calibration_ca_filter_mem[0] ), .width = sizeof( _calibration_ca_filter_mem[0] )};
static LookupTable calibration_ca_correction = {.ptr = _calibration_ca_correction, .rows = 1, .cols = sizeof( _calibration_ca_correction ) / sizeof( _calibration_ca_correction[0] ), .width = sizeof( _calibration_ca_correction[0] )};
static LookupTable calibration_ca_correction_mem = {.ptr = _calibration_ca_correction_mem, .cols = 10, .rows = sizeof( _calibration_ca_correction_mem ) / sizeof( _calibration_ca_correction_mem[0] ), .width = sizeof( _calibration_ca_correction_mem[0][0] )};
static LookupTable calibration_lut3d_mem = {.ptr = _calibration_lut3d_mem, .rows = 1, .cols = sizeof( _calibration_lut3d_mem ) / sizeof( _calibration_lut3d_mem[0] ), .width = sizeof( _calibration_lut3d_mem[0] )};

uint32_t get_calibrations_static_linear_imx307_demo( ACameraCalibrations *c )
{
    uint32_t result = 0;
    if ( c != 0 ) {
        c->calibrations[CALIBRATION_SHADING_RADIAL_R] = &calibration_shading_radial_r;
        c->calibrations[CALIBRATION_SHADING_RADIAL_G] = &calibration_shading_radial_g;
        c->calibrations[CALIBRATION_SHADING_RADIAL_B] = &calibration_shading_radial_b;
        c->calibrations[CALIBRATION_DECOMPANDER0_MEM] = &calibration_decompander0_mem;
        c->calibrations[CALIBRATION_DECOMPANDER1_MEM] = &calibration_decompander1_mem;
        c->calibrations[CALIBRATION_LIGHT_SRC] = &calibration_light_src;
        c->calibrations[CALIBRATION_RG_POS] = &calibration_rg_pos;
        c->calibrations[CALIBRATION_BG_POS] = &calibration_bg_pos;
        c->calibrations[CALIBRATION_MESH_RGBG_WEIGHT] = &calibration_mesh_rgbg_weight;
        c->calibrations[CALIBRATION_MESH_LS_WEIGHT] = &calibration_mesh_ls_weight;
        c->calibrations[CALIBRATION_MESH_COLOR_TEMPERATURE] = &calibration_mesh_color_temperature;
        c->calibrations[CALIBRATION_WB_STRENGTH] = &calibration_wb_strength;
        c->calibrations[CALIBRATION_SKY_LUX_TH] = &calibration_sky_lux_th;
        c->calibrations[CALIBRATION_CT_RG_POS_CALC] = &calibration_ct_rg_pos_calc;
        c->calibrations[CALIBRATION_CT_BG_POS_CALC] = &calibration_ct_bg_pos_calc;
        c->calibrations[CALIBRATION_COLOR_TEMP] = &calibration_color_temp;
        c->calibrations[CALIBRATION_CT65POS] = &calibration_ct65pos;
        c->calibrations[CALIBRATION_CT40POS] = &calibration_ct40pos;
        c->calibrations[CALIBRATION_CT30POS] = &calibration_ct30pos;
        c->calibrations[CALIBRATION_EVTOLUX_EV_LUT] = &calibration_evtolux_ev_lut;
        c->calibrations[CALIBRATION_EVTOLUX_LUX_LUT] = &calibration_evtolux_lux_lut;
        c->calibrations[CALIBRATION_BLACK_LEVEL_R] = &calibration_black_level_r;
        c->calibrations[CALIBRATION_BLACK_LEVEL_GR] = &calibration_black_level_gr;
        c->calibrations[CALIBRATION_BLACK_LEVEL_GB] = &calibration_black_level_gb;
        c->calibrations[CALIBRATION_BLACK_LEVEL_B] = &calibration_black_level_b;
        c->calibrations[CALIBRATION_STATIC_WB] = &calibration_static_wb;
        c->calibrations[CALIBRATION_MT_ABSOLUTE_LS_A_CCM] = &calibration_mt_absolute_ls_a_ccm;
        c->calibrations[CALIBRATION_MT_ABSOLUTE_LS_D40_CCM] = &calibration_mt_absolute_ls_d40_ccm;
        c->calibrations[CALIBRATION_MT_ABSOLUTE_LS_D50_CCM] = &calibration_mt_absolute_ls_d50_ccm;
        c->calibrations[CALIBRATION_SHADING_LS_A_R] = &calibration_shading_ls_a_r;
        c->calibrations[CALIBRATION_SHADING_LS_A_G] = &calibration_shading_ls_a_g;
        c->calibrations[CALIBRATION_SHADING_LS_A_B] = &calibration_shading_ls_a_b;
        c->calibrations[CALIBRATION_SHADING_LS_TL84_R] = &calibration_shading_ls_tl84_r;
        c->calibrations[CALIBRATION_SHADING_LS_TL84_G] = &calibration_shading_ls_tl84_g;
        c->calibrations[CALIBRATION_SHADING_LS_TL84_B] = &calibration_shading_ls_tl84_b;
        c->calibrations[CALIBRATION_SHADING_LS_D65_R] = &calibration_shading_ls_d65_r;
        c->calibrations[CALIBRATION_SHADING_LS_D65_G] = &calibration_shading_ls_d65_g;
        c->calibrations[CALIBRATION_SHADING_LS_D65_B] = &calibration_shading_ls_d65_b;
        c->calibrations[CALIBRATION_AWB_WARMING_LS_A] = &calibration_awb_warming_ls_a;
        c->calibrations[CALIBRATION_AWB_WARMING_LS_D50] = &calibration_awb_warming_ls_d50;
        c->calibrations[CALIBRATION_AWB_WARMING_LS_D75] = &calibration_awb_warming_ls_d75;
        c->calibrations[CALIBRATION_NOISE_PROFILE] = &calibration_noise_profile;
        c->calibrations[CALIBRATION_DEMOSAIC] = &calibration_demosaic;
        c->calibrations[CALIBRATION_WDR_NP_LUT] = &calibration_wdr_np_lut;
        c->calibrations[CALIBRATION_GAMMA] = &calibration_gamma;
        c->calibrations[CALIBRATION_IRIDIX_ASYMMETRY] = &calibration_iridix_asymmetry;
        c->calibrations[CALIBRATION_AWB_SCENE_PRESETS] = &calibration_awb_scene_presets;
        c->calibrations[CALIBRATION_CA_FILTER_MEM] = &calibration_ca_filter_mem;
        c->calibrations[CALIBRATION_CA_CORRECTION] = &calibration_ca_correction;
        c->calibrations[CALIBRATION_CA_CORRECTION_MEM] = &calibration_ca_correction_mem;
        c->calibrations[CALIBRATION_LUT3D_MEM] = &calibration_lut3d_mem;
    } else {
        result = -1;
    }
    return result;
}
